package com.oj.judge.codesandbox.impl;
import com.oj.judge.domain.ExecuteCodeRequest;
import com.oj.judge.domain.ExecuteCodeResponse;
import com.oj.judge.codesandbox.CodeSandBox;
import com.oj.judge.domain.JudgeResult;
import com.oj.judge.enums.JudgeResultMessageEnum;
import com.oj.judge.enums.QuestionSubmitStatusEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ExampleCodeSandBox implements CodeSandBox {

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();
        String code = executeCodeRequest.getCode();
        String language = executeCodeRequest.getLanguage();

        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试执行成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getValue());

        JudgeResult judgeInfo = new JudgeResult();
        judgeInfo.setMemory(100);
        judgeInfo.setTime(1000);

        executeCodeResponse.setJudgeResult(judgeInfo);

        return executeCodeResponse;
    }
}